package yc.star.friend.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yc.star.common.constants.HttpConstants;
import yc.star.common.controller.BaseController;
import yc.star.common.domain.AppResult;
import yc.star.common.domain.TableDataInfo;
import yc.star.friend.aspect.CheckUserStatus;
import yc.star.friend.domain.exam.dto.ExamDTO;
import yc.star.friend.domain.exam.dto.ExamQueryDTO;
import yc.star.friend.service.IUserExamService;

@RequestMapping("/user/exam")
@RestController
public class UserExamController extends BaseController {

    @Autowired
    private IUserExamService userExamService;

    @CheckUserStatus
    @PostMapping("/enter")
     public AppResult<Void> enter (@RequestHeader(HttpConstants.AUTHENTICATION) String token
            , @RequestBody ExamDTO examDTO) {
        int rows = userExamService.enter(token, examDTO);
        return toAppResult(rows);
    }

    @GetMapping("/list")
    public TableDataInfo list (ExamQueryDTO examQueryDTO) {
        return userExamService.list(examQueryDTO);
    }

}